package com.linjacy.httpproject.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class DirectRabbitConfig {

    @Bean
    public Queue TestDirectQueue(){
        //durable:是否持久化
        return new Queue("TestDirectQueue", true);
    }

    @Bean
    public DirectExchange TestDirectExchange(){
        //交换机
        return new DirectExchange("TestDirectExchange", true, false);
    }

    @Bean
    public Binding bindingDirect(){
        return BindingBuilder.bind(TestDirectQueue()).to(TestDirectExchange()).with("TestBiding");
    }
}
